package com.cp.core.controller.admin;


import com.cp.common.result.R;
import com.cp.core.pojo.entity.UserLoginRecord;
import com.cp.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户登录记录表 前端控制器
 * </p>
 *
 * @author ming
 * @since 2022-07-27
 */
@RestController
@RequestMapping("/admin/core/userLoginRecord")
@Slf4j
//@CrossOrigin
@Api(tags = "登录日志")
public class AdminUserLoginRecordController {
    @Resource
    private UserLoginRecordService userLoginRecordService;
    @ApiOperation("获取会员登录日志列表")
    @GetMapping("/getTop50ById/{userId}")
    public R listTop50(@PathVariable("userId") Long userId){
        List<UserLoginRecord> userLoginRecords =  userLoginRecordService.selectTop50(userId);
        return R.ok().data("loginRecords",userLoginRecords);
    }

}

